from datetime import datetime
from typing import List, Union
from pydantic import BaseModel
from typing_extensions import Annotated


class User(BaseModel):
    id: Annotated[int, "This is the ID of the user."]
    name: str = "John Doe"
    signup_ts: Union[datetime, None] = None
    friends: List[int] = []
    required: bool = ...
    
    
data001 = {
    "id": "123",
    "signup_ts": "2017-06-01 12:22",
    "friends": [1, '2', b'3'],
    "required": True,
}
user001 = User(**data001)
print('user001:', user001)

data002 = {
    "id": 456,
    "signup_ts": datetime.now(),
    "required": 0,
}
user002 = User(**data002)
print('user002:', user002)
